Skip to content

Conversation

@laines-it
Copy link
Collaborator

@laines-it laines-it commented Oct 23, 2025

Method box.New now returns (*Box, error), because avoiding panics entirely in third-party libraries is ideal, since we can't break compatibility.
Nonetheless, there is still a way to panic on error, via implemented box.MustNew wrapper.

I didn't forget about (remove if it is not applicable):

Closes #448

Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the patch. See comments below.

Please, add an entry into the migration guide about the breaking change:

Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A commit message should be well-formatted too:

50 chars max for a title line.
72 chars max for a message line.

box: box.New returns an error instead of panic

Method `box.New` now returns (*Box, error), because avoiding panics
entirely in third-party libraries is ideal, since we can't break
compatibility

Nonetheless, there is still a way to panic on error, via implemented
`box.MustNew` wrapper.

Closes #448

See:

https://www.tarantool.io/en/doc/latest/contributing/developer_guidelines/#how-to-write-a-commit-message

Copy link
Collaborator Author

@laines-it laines-it left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message is bad-formatted. Should be:

Tests now use `box.MustNew` instead of `box.New`.

Added TestMocked_BoxNew for box.New creating a workable object
by means of checking length of Request[] in mockDoer after subrequest.

Closes #448

@laines-it laines-it marked this pull request as ready for review October 25, 2025 23:22
Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, rewrite commit messages according the rules:

https://www.tarantool.io/en/doc/latest/contributing/developer_guidelines/#how-to-write-a-commit-message

<=50 char for a title line
<= 72 chars for a message line

@laines-it laines-it force-pushed the laines-it/gh-448-box-New-return-error branch from b031345 to d839e4c Compare October 27, 2025 13:36
Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, format the first commit correctly according to the rules:

https://www.tarantool.io/en/doc/latest/contributing/developer_guidelines/#how-to-write-a-commit-message

box: box.New returns an error instead of panic
Method `box.New` now returns (*Box, error), because avoiding panics entirely in third-party libraries is ideal, since we can't break compatibility
Nonetheless, there is still a way to panic on error, via implemented `box.MustNew` wrapper.

Closes #448

->

box: box.New returns an error instead of panic

Method `box.New` now returns (*Box, error), because avoiding panics
entirely in third-party libraries is ideal, since we can't break
compatibility.

Nonetheless, there is still a way to panic on error, via implemented
`box.MustNew` wrapper.

Part of #448

And it should be Part of, not Closes since it is a not last commit in a sequence related to the issue.

Method `box.New` now returns (*Box, error), because avoiding panics
entirely in third-party libraries is ideal, since we can't break
compatibility.

Nonetheless, there is still a way to panic on error, via implemented
`box.MustNew` wrapper.

Part of #448
Tests now use `box.MustNew` instead of `box.New`.

Added TestMocked_BoxNew for box.New creating a workable object
by means of checking length of Request[] in mockDoer after subrequest.

Closes #448
@laines-it laines-it force-pushed the laines-it/gh-448-box-New-return-error branch from d839e4c to 5490645 Compare October 27, 2025 14:37
Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the patch!

@laines-it laines-it merged commit cbcf6a4 into master Oct 27, 2025
27 checks passed
@laines-it laines-it deleted the laines-it/gh-448-box-New-return-error branch October 27, 2025 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v3: box.New should return an error instead of panic

4 participants